//
//  PersonalHeadShowCell.m
//  WEIMO
//
//  Created by Lixiaoyong on 13-7-17.
//  Copyright (c) 2013年 广州从兴电子开发有限公司. All rights reserved.
//

#import "PersonalHeadShowCell.h"

#import <QuartzCore/QuartzCore.h>

#define kClearColor [UIColor clearColor]

@implementation PersonalHeadShowCell
@synthesize headerImageView;
@synthesize nameLable,professionLable,gradeLable,sepSpaceLable;

- (void)dealloc
{
    self.headerImageView = nil;
    self.nameLable = nil;
    self.professionLable = nil;
    self.gradeLable = nil;
    self.sepSpaceLable = nil;
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.contentView.backgroundColor = [UIColor colorWithRed:37.0/255 green:37.0/255 blue:37.0/255 alpha:1.0];
        
        CGRect rect = CGRectZero;
        self.headerImageView = [[[TouchImageView alloc] initWithFrame:rect] autorelease];
        self.headerImageView.delegate = self;
        self.headerImageView.backgroundColor = kClearColor;
        self.headerImageView.layer.masksToBounds = YES;
        self.headerImageView.layer.cornerRadius = 4.0;//12.0;
        [self addSubview:self.headerImageView];
        
        self.nameLable = [[[UILabel alloc] initWithFrame:rect] autorelease];
        self.nameLable.backgroundColor = kClearColor;
        self.nameLable.textColor = [UIColor whiteColor];
        [self addSubview:self.nameLable];
        
        self.professionLable = [[[UILabel alloc] initWithFrame:rect] autorelease];
        self.professionLable.backgroundColor = kClearColor;
        self.professionLable.textColor = [UIColor whiteColor];
        [self addSubview:self.professionLable];
        
        self.gradeLable = [[[UILabel alloc] initWithFrame:rect] autorelease];
        self.gradeLable.backgroundColor = kClearColor;
        self.gradeLable.textColor = [UIColor whiteColor];
        [self addSubview:self.gradeLable];
        
        self.sepSpaceLable = [[[UILabel alloc] initWithFrame:rect] autorelease];
        self.sepSpaceLable.backgroundColor = [UIColor blackColor];
        self.sepSpaceLable.text = @"  模特资料展示";
        self.sepSpaceLable.textColor = [UIColor grayColor];
        self.sepSpaceLable.font = [UIFont systemFontOfSize:13.0];
        [self addSubview:self.sepSpaceLable];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

- (void)drawRect:(CGRect)rect
{
    float width = rect.size.width;
    float height = rect.size.height;
    float oY = 5.0;
    
    rect = CGRectMake(10, oY, 80.0, 78);
    self.headerImageView.frame = rect;
    
    rect.origin.x = rect.origin.x + rect.size.width + 15;
    rect.size.width = width - rect.origin.x - 20;
    rect.size.height = 78 / 3.0;
    self.nameLable.frame = rect;
    
    rect.origin.y = rect.origin.y + rect.size.height;
    self.professionLable.frame = rect;
    
    rect.origin.y = rect.origin.y + rect.size.height + 15.0;
    self.gradeLable.frame = rect;
    
    rect.origin.y = rect.origin.y + 15;
    rect = CGRectMake(0, rect.origin.y, width, height - rect.origin.y);
    self.sepSpaceLable.frame = rect;
}

#pragma mark - TouchImageViewDelegate

- (void)clickImageView:(TouchImageView *)imageView
{
    if (self.delegate)
    {
        [self.delegate clickedHeaderImage];
    }
}

@end